package com.midea.ai.air.ui.more.adapter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.midea.ai.air.R;
import com.midea.ai.air.ui.more.MoreSettingBrainpowerStartCondition_StartTime;
import com.midea.ai.air.ui.more.data.MoreElectricityShow;
import com.midea.ai.air.ui.more.data.MoreSelectedData;

import java.util.List;

/**
 * Created by hww on 2016/4/23
 * <p/>
 * 电量报告 月 用户详细电量报告.
 */
public class MoreSettingElectricityReportShowEleAdapter extends ArrayAdapter<MoreElectricityShow> {
    private LayoutInflater mInflater;

    public MoreSettingElectricityReportShowEleAdapter(Context context, List<MoreElectricityShow> objects) {
        super(context, 0, objects);
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;
        MoreElectricityShow item = getItem(position);
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.list_item_more_ele_report, parent, false);
            holder = new ViewHolder();
            holder.tvDate = (TextView) convertView.findViewById(R.id.item_more_ele_date);
            holder.tvData_C = (TextView) convertView.findViewById(R.id.item_more_ele_c);
            holder.line = (View) convertView.findViewById(R.id.bot_line);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.tvDate.setText(item.getmDate());
        holder.tvData_C.setText(item.getmData_C());

        if (position == getCount() - 1) {
            holder.line.setVisibility(View.GONE);
        } else {
            holder.line.setVisibility(View.VISIBLE);
        }

        return convertView;
    }

    public class ViewHolder {
        public TextView tvDate;
        public TextView tvData_C;
        public View line;
    }

}
